// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Label)
    label: cc.Label = null;

    @property
    text: string = 'hello';

    all: cc.Node = null;
    onLoad () {
        this.all = cc.find('Canvas/气泡框3/body/心脏');
        this.all.on(cc.Node.EventType.TOUCH_START, this.changeProgressBar, this)  
        
    }
     
    changeProgressBar () {
        this.schedule(this.changeProgressBar, 0.5);//每隔x秒减下面n的进度
        this.node.getComponent(cc.Sprite).fillRange -= 0.0175;//每x秒所减少的环形百分比
        if (this.node.getComponent(cc.Sprite).fillRange <= 0) {
            this.unschedule(this.changeProgressBar);
            this.all = cc.find('Canvas/错误3');
            this.all.active = true;
            
        }
    }

    start () {

    }
    // update (dt) {}
}
